public class DirectMappedCache extends Cache
{
  int[] cache;
  boolean[] dataVaild;
  Object[] cacheData;
  int indexS;
  int index;
  int ignored;
  int tag;

  DirectMappedCache(int paramInt1, int paramInt2)
  {
    this.size = paramInt1;
    this.line_size = paramInt2;
    this.cache = new int[this.size / this.line_size];
    this.cacheData = new Object[this.size / this.line_size];
    this.dataVaild = new boolean[this.size / this.line_size];
    for (int i = 0; i < this.size / this.line_size; i++) this.dataVaild[i] = false; 
  }

  public Object cacheSearch(int paramInt)
  {
    //int i = paramInt % (2 * this.size) / (this.line_size * 2);
  	int index = ((paramInt / this.line_size) % this.size) % (this.size / this.line_size);
  	int ignored = (paramInt % this.line_size);
  	int tag = (paramInt / this.line_size) / this.size;
    if ((this.dataVaild[index] != false) && (this.cache[index] == tag)) {
      indexS = index;
      return this.cacheData[index];
    }return null;
  }

  public oldCacheLineInfo cacheNewEntry(int paramInt) {
    //int i = paramInt % (2 * this.size) / (this.line_size * 2);
  	int index = ((paramInt / this.line_size) % this.size) % (this.size / this.line_size);
  	int ignored = (paramInt % this.line_size);
  	int tag = (paramInt / this.line_size) /this.size;
    oldCacheLineInfo localoldCacheLineInfo = new oldCacheLineInfo();
    localoldCacheLineInfo.old_valid = this.dataVaild[index];
    this.cache[index] = tag;
    this.dataVaild[index] = true;
    localoldCacheLineInfo.data = (this.cacheData[index] = new Integer(-1));
    return localoldCacheLineInfo;
  }

  public void cacheWriteData(Object paramObject) {
    this.cacheData[this.indexS] = paramObject;
  }
}
